home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-08-16 | 2.1 KB | 79 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLGrGlob.cpp
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef SLGRGLOB_H
- #include "SLGrGlob.h"
- #endif
-
- #ifndef FWPRIDEB_H
- #include "FWPriDeb.h"
- #endif
-
- //========================================================================================
- // RunTime Info
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwgraphx
- #endif
-
- //========================================================================================
- // Graphics globals
- //========================================================================================
-
- #ifdef FW_BUILD_MAC
- CGrafPort FW_gPrivScratchPortRecord;
- GrafPtr FW_gScratchPort = NULL;
- #endif
-
- static short gRefCount = 0;
-
- //----------------------------------------------------------------------------------------
- // FW_PrivInitializeGraphicsGlobals
- //----------------------------------------------------------------------------------------
-
- void SL_API FW_PrivInitializeGraphicsGlobals()
- {
- if (++ gRefCount == 1)
- {
- #ifdef FW_BUILD_MAC
- FW_ASSERT (FW_gScratchPort == NULL);
-
- #if defined(__MWERKS__) && GENERATING68K
- Rect rBounds;
- rBounds.top = rBounds.left = 0;
- rBounds.right = rBounds.bottom = 0;
- #else
- Rect rBounds = { 0, 0, 10 , 10 };
- #endif
-
- ::OpenCPort(&FW_gPrivScratchPortRecord);
- FW_gScratchPort = (GrafPtr)&FW_gPrivScratchPortRecord;
- #endif
- }
- }
-
- //----------------------------------------------------------------------------------------
- // FW_PrivTerminateGraphicsGlobals
- //----------------------------------------------------------------------------------------
-
- void SL_API FW_PrivTerminateGraphicsGlobals()
- {
- if (-- gRefCount == 0)
- {
- #ifdef FW_BUILD_MAC
- FW_ASSERT(FW_gScratchPort != NULL);
- ::CloseCPort(&FW_gPrivScratchPortRecord);
- FW_gScratchPort = NULL;
- #endif
- }
- }
-